<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <title>修改个人信息</title>
</head>
<body>
<h2>修改个人信息</h2>
<form action="${pageContext.request.contextPath}/user/update" method="post">
    <table>
        <tr>
            <td>ID：</td>
            <td><input type="text" name="id" value="${user.id}" readonly></td>
        </tr>
        <tr>
            <td>用户名：</td>
            <td><input type="text" name="username" value="${user.username}" required></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input type="password" name="password" value="${user.password}" required></td>
        </tr>
        <tr>
            <td>邮箱：</td>
            <td><input type="email" name="email" value="${user.email}" required></td>
        </tr>
        <tr>
            <td>手机号：</td>
            <td><input type="text" name="phone" value="${user.phone}" required></td>
        </tr>
        <tr>
            <td>用户角色：</td>
            <td>
                <c:choose>
                    <c:when test="${user.role == 0}">
                        <input type="radio" name="role" value="0" checked> 普通用户
                        <input type="radio" name="role" value="1"> 专家用户
                        <input type="radio" name="role" value="2"> 管理员
                    </c:when>
                    <c:when test="${user.role == 1}">
                        <input type="radio" name="role" value="0"> 普通用户
                        <input type="radio" name="role" value="1" checked> 专家用户
                        <input type="radio" name="role" value="2"> 管理员
                    </c:when>
                    <c:otherwise>
                        <input type="radio" name="role" value="0"> 普通用户
                        <input type="radio" name="role" value="1"> 专家用户
                        <input type="radio" name="role" value="2" checked> 管理员
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
        <tr>
            <td colspan="2"><button type="submit">保存修改</button></td>
        </tr>
    </table>
</form>
</body>
</html>